<div>
    <fieldset>
        <legend>SQL запрос:</legend>

        <textarea class="Text" id="SqlQueryArea"
            style="width: 100%; height: 100px; "></textarea>
        <div>
            <label for="NumRows">Число строк результата </label>
            <select id="NumRows" style="width: 6em;">
                <option value="10">10</option>
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="40">40</option>
                <option value="100">100</option>
                <option value="500">400</option>
            </select>
            <button id="SendQuery"/>Выполнить</button>
        </div>

    </fieldset>

    <div id="QueryResult" style="padding-left: 1em; width: 80%"><?php echo $this->QuerySwitchPage(); ?></div>

    <script type="text/javascript">
        jsun.run(function() {

        jsun("#SendQuery").jsun.event({ onclick: SendQuery });

        function SendQuery() {
            var query = encodeURIComponent(jsun("#SqlQueryArea").value),
                num_rows = jsun("#NumRows").value,
                pref= "SqlQuery",
                req = "u=Admin&m=Admin\\Sql/Page"
                    + "&Rows=" + num_rows
                    + "&Query=" + query;
            jsun.swap[pref]["Page"] = 1;
            jsun.swap[pref]["Req"] = req;
            jsun.swap[pref]["Start"]();
            return true;
        }

        });
    </script>
</div>